package com.cjx.stars.common;

import com.cjx.stars.constant.FailMessage;
import com.cjx.stars.constant.ResultCode;

/**
 * @author cjx
 * @description 辅助返回类型的创建
 * @createDate 2024/2/28 21:03
 **/
public class ResponseUtils {

    public static <T> Response<T> success(T data ){
        return new Response(ResultCode.SUCCESS_CODE,"success",data);
    }

    public static <T> Response<T> success(){
        return new Response(ResultCode.SUCCESS_CODE,"success");
    }

    public static Response<?> fail(FailMessage failMessage){
        return new Response(failMessage.getCode(),failMessage.getMessage());
    }

}
